{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

{{#if (eq this.selectedAction "rotate")}}
  {{#if this.key.canRotate}}
    <ConfirmAction
      @buttonClasses="toolbar-link"
      @confirmTitle="Rotate this key?"
      @confirmMessage="After rotation, all key actions will default to using the newest version of the key."
      @confirmButtonText="Rotate"
      @onConfirmAction={{action "doSubmit"}}
      data-test-transit-key-rotate
    >
      Rotate encryption key
    </ConfirmAction>
  {{/if}}
{{else}}
  <MessageError @errors={{this.errors}} />
  {{#if this.selectedAction}}
    <div data-test-transit-action={{this.selectedAction}}>
      {{! template-lint-disable no-passed-in-event-handlers }}
      {{component
        (concat "transit-key-action/" this.selectedAction)
        key=this.key
        keys=this.keys
        keyIsRSA=this.keyIsRSA
        verification=this.verification
        hmac=this.hmac
        param=this.param
        key_version=this.key_version
        isModalActive=this.isModalActive
        ciphertext=this.ciphertext
        plaintext=this.plaintext
        context=this.context
        nonce=this.nonce
        input=this.input
        bits=this.bits
        algorithm=this.algorithm
        signature=this.signature
        signature_algorithm=this.signature_algorithm
        hash_algorithm=this.hash_algorithm
        prehashed=this.prehashed
        wrappedToken=this.wrappedToken
        exportKeyType=this.exportKeyType
        exportKeyVersion=this.exportKeyVersion
        encodedBase64=this.encodedBase64
        valid=this.valid
        doSubmit=(action "doSubmit")
        clearParams=(action "clearParams")
      }}
    </div>
  {{/if}}
{{/if}}